<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>云办公</el-breadcrumb-item>
      <el-breadcrumb-item>流程部署</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <!-- 请假文件上传图标显示 -->
      <el-form :inline="true">
        <el-form-item>
          <div class="one">
            <span>请假文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended.suspended"
              @change="statechanged"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 报销文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>报销文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended1.suspended"
              @change="statechanged1"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible1 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 补卡文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>补卡文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended2.suspended"
              @change="statechanged2"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible2 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 出差文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>出差文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended3.suspended"
              @change="statechanged3"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible3 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 调岗文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>调岗文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended4.suspended"
              @change="statechanged4"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible4 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 调薪文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>调薪文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended5.suspended"
              @change="statechanged5"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible5 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 加班文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>加班文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended6.suspended"
              @change="statechanged6"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible6 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 离职文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>离职文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended7.suspended"
              @change="statechanged7"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible7 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 转正文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>转正文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended8.suspended"
              @change="statechanged8"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible8 = true"
            ></i>
          </div>
        </el-form-item>
        <!-- 销假/出差文件上传图标显示 -->
        <el-form-item>
          <div class="one">
            <span>销假文件</span>
            <el-divider direction="vertical"></el-divider>
            <!-- 流程挂起激活滑块 -->
            <el-switch
              v-model="suspended9.suspended"
              @change="statechanged9"
              active-value="true"
              inactive-value="false"
            >
            </el-switch>
            <!-- 文件上传图标 -->
            <el-divider direction="vertical"></el-divider>
            <i class="el-icon-upload2" @click="uploadDialogVisible = true"></i>
            <!-- 文件删除图标 -->
            <!-- <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-delete"
              @click="deleteDeploy(definition.deploymentId)"
            ></i> -->
            <!-- 文件下载图标 -->
            <a></a>
            <el-divider direction="vertical"></el-divider>
            <i
              class="el-icon-download"
              @click="downloadDialogVisible9 = true"
            ></i>
          </div>
        </el-form-item>
      </el-form>
      <!-- 信息列表 -->
      <el-table border stripe :data="definition">
        <el-table-column label="序号" type="index"> </el-table-column>
        <el-table-column label="部门名称" prop="deploymentId">
        </el-table-column>
        <el-table-column label="联系电话" prop="diagramResourceName">
        </el-table-column>
        <el-table-column label="邮箱" prop="id"> </el-table-column>
        <el-table-column label="备注" prop="processKey"> </el-table-column>
        <el-table-column label="简介" prop="resourceName"> </el-table-column>
        <el-table-column label="简介" prop="version"> </el-table-column>
        <el-table-column label="操作" width="145px">
          <template slot-scope="scope">
            <el-button
              type="danger"
              size="mini"
              @click="deleteDeploy(scope.row.deploymentId)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <!-- 文件上传对话框 -->
      <el-dialog
        title="文件上传(需要同时上传bpmn和png文件！)"
        :visible.sync="uploadDialogVisible"
        width="70%"
        @close="uploadDialogClosed"
      >
        <!-- 内容主题区 -->
        <el-form ref="uploadFormRef" label-width="50px" :inline="true">
          <el-form-item>
            <el-upload
              :action="action"
              :file-list="fileList"
              :http-request="modeUpload1"
            >
              <el-button slot="trigger" size="small" type="primary"
                >选取bpmn文件</el-button
              >
            </el-upload>
          </el-form-item>
          <el-form-item>
            <el-upload
              :action="action"
              :file-list="fileList"
              :http-request="modeUpload2"
            >
              <el-button slot="trigger" size="small" type="primary"
                >选取png文件</el-button
              >
            </el-upload>
          </el-form-item>
          <el-form-item>
            <el-button type="success" @click="upload">点击上传文件</el-button>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="uploadDialogVisible = false"
            >上传结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 请假文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible"
        width="50%"
        @close="downloadDialogClosed"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef" label-width="100px">
          <el-button type="success" @click="downloadBpmn"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng">下载png文件</el-button>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible = false">下载结束</el-button>
        </span>
      </el-dialog>
      <!-- 报销文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible1"
        width="50%"
        @close="downloadDialogClosed1"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef1" label-width="100px">
          <el-button type="success" @click="downloadBpmn1"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng1"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible1 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 补卡文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible2"
        width="50%"
        @close="downloadDialogClosed2"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef2" label-width="100px">
          <el-button type="success" @click="downloadBpmn2"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng2"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible2 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 出差文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible3"
        width="50%"
        @close="downloadDialogClosed3"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef3" label-width="100px">
          <el-button type="success" @click="downloadBpmn3"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng3"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible3 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 调岗文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible4"
        width="50%"
        @close="downloadDialogClosed4"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef4" label-width="100px">
          <el-button type="success" @click="downloadBpmn4"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng4"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible4 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 调薪文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible5"
        width="50%"
        @close="downloadDialogClosed5"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef5" label-width="100px">
          <el-button type="success" @click="downloadBpmn5"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng5"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible5 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 加班文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible6"
        width="50%"
        @close="downloadDialogClosed6"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef6" label-width="100px">
          <el-button type="success" @click="downloadBpmn6"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng6"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible6 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 离职文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible7"
        width="50%"
        @close="downloadDialogClosed7"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef7" label-width="100px">
          <el-button type="success" @click="downloadBpmn7"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng7"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible7 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 转正文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible8"
        width="50%"
        @close="downloadDialogClosed8"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef8" label-width="100px">
          <el-button type="success" @click="downloadBpmn8"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng8"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible8 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
      <!-- 销假、出差文件下载对话框 -->
      <el-dialog
        title="文件下载"
        :visible.sync="downloadDialogVisible9"
        width="50%"
        @close="downloadDialogClosed9"
      >
        <!-- 内容主题区 -->
        <el-form ref="downloadFormRef9" label-width="100px">
          <el-button type="success" @click="downloadBpmn9"
            >下载bpmn文件</el-button
          >
          <el-button type="primary" @click="downloadPng9"
            >下载png文件</el-button
          >
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="downloadDialogVisible9 = false"
            >下载结束</el-button
          >
        </span>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
// import qs from "qs";
export default {
  data() {
    return {
      //状态码绑定值
      suspended: {
        suspended: "true",
      },
      suspended1: {
        suspended: "true",
      },
      suspended2: {
        suspended: "true",
      },
      suspended3: {
        suspended: "true",
      },
      suspended4: {
        suspended: "true",
      },
      suspended5: {
        suspended: "true",
      },
      suspended6: {
        suspended: "true",
      },
      suspended7: {
        suspended: "true",
      },
      suspended8: {
        suspended: "true",
      },
      suspended9: {
        suspended: "true",
      },
      //查询到的流程定义信息
      definition: [],
      //状态部署信息请求参数
      processKey: "",

      // 文件上传对话框隐藏
      uploadDialogVisible: false,
      // 文件下载对话框隐藏
      downloadDialogVisible: false,
      downloadDialogVisible1: false,
      downloadDialogVisible2: false,
      downloadDialogVisible3: false,
      downloadDialogVisible4: false,
      downloadDialogVisible5: false,
      downloadDialogVisible6: false,
      downloadDialogVisible7: false,
      downloadDialogVisible8: false,
      downloadDialogVisible9: false,

      action: "https://jsonplaceholder.typicode.com/posts/",
      mode1: {},
      mode2: {},
      fileList: [],
      filename: "",
    };
  },
  created() {
    this.getInfo();
    // this.statechanged();
    //  this.statechanged1();
  },
  methods: {
    //监听文件上传表单的关闭事件
    uploadDialogClosed() {
      this.$refs.uploadFormRef.resetFields();
    },
    //监听文件下载表单的关闭事件
    downloadDialogClosed() {
      this.$refs.downloadFormRef.resetFields();
    },
    downloadDialogClosed1() {
      this.$refs.downloadFormRef1.resetFields();
    },
    downloadDialogClosed2() {
      this.$refs.downloadFormRef2.resetFields();
    },
    downloadDialogClosed3() {
      this.$refs.downloadFormRef3.resetFields();
    },
    downloadDialogClosed4() {
      this.$refs.downloadFormRef4.resetFields();
    },
    downloadDialogClosed5() {
      this.$refs.downloadFormRef5.resetFields();
    },
    downloadDialogClosed6() {
      this.$refs.downloadFormRef6.resetFields();
    },
    downloadDialogClosed7() {
      this.$refs.downloadFormRef7.resetFields();
    },
    downloadDialogClosed8() {
      this.$refs.downloadFormRef8.resetFields();
    },
    downloadDialogClosed9() {
      this.$refs.downloadFormRef9.resetFields();
    },
    //查询流程定义信息接口
    async getInfo() {
      const { data: res } = await this.$http.get("/process/findDefinition");
      console.log(res);
      this.definition = res.data;
      console.log(this.definition);
    },

    //请假状态码接口
    statechanged() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=leave", {
          params: this.suspended,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("请假流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("请假流程激活成功!");
          }
        });
    },
    //报销状态码接口
    statechanged1() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=reimbursement", {
          params: this.suspended1,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("报销流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("报销流程激活成功!");
          }
        });
    },
    //补卡状态码接口
    statechanged2() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=fillClock", {
          params: this.suspended2,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("补卡流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("补卡流程激活成功!");
          }
        });
    },
    //出差状态码接口
    statechanged3() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=travel", {
          params: this.suspended3,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("出差流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("出差流程激活成功!");
          }
        });
    },
    //调岗状态码接口
    statechanged4() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=adjustJob", {
          params: this.suspended4,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("调岗流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("调岗流程激活成功!");
          }
        });
    },
    //调薪状态码接口
    statechanged5() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=adjustSalary", {
          params: this.suspended5,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("调薪流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("调薪流程激活成功!");
          }
        });
    },
    //加班状态码接口
    statechanged6() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=overtime", {
          params: this.suspended6,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("加班流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("加班流程激活成功!");
          }
        });
    },
    //离职状态码接口
    statechanged7() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=separation", {
          params: this.suspended7,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("离职流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("离职流程激活成功!");
          }
        });
    },
    //转正状态码接口
    statechanged8() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=positive", {
          params: this.suspended8,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("转正流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("转正流程激活成功!");
          }
        });
    },
    //销假、出差状态码接口
    statechanged9() {
      console.log();
      this.$http
        .get("process/suspendProcess?processKey=destroy", {
          params: this.suspended9,
        })
        .then((res) => {
          console.log(res);
          if (res.data.message == "流程挂起成功") {
            return this.$message.error("销假、出差流程挂起成功!");
          }
          if (res.data.message == "流程激活成功") {
            return this.$message.success("销假、出差流程激活成功!");
          }
        });
    },

    //将上传成功的文件保存到mode里面
    modeUpload1: function (item) {
      console.log(item.file);
      this.mode1 = item.file;
    },
    modeUpload2: function (item) {
      console.log(item.file);
      this.mode2 = item.file;
    },
    //文件上传接口
    upload: function () {
      let fd = new FormData();
      fd.append("bpmnFile", this.mode1);
      fd.append("pngFile", this.mode2);
      this.$http
        .post("/process/deploy", fd, {
          headers: {
            "Content-Type": "multipart/form-data",
          },
        })
        .then((res) => {
          console.log(res);
          this.getInfo();
          if (res.data.message == "部署成功") {
            return this.$message.success("上传部署信息成功");
          }
          this.$message.error("上传部署信息失败");
        });
    },
    //删除流程部署信息接口
    async deleteDeploy(deploymentId) {
      console.log(deploymentId);
      const confirmResult = await this.$confirm(
        "此操作将永久删除该部署信息, 是否继续?",
        "删除部署信息",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).catch((err) => err);
      if (confirmResult !== "confirm") {
        return this.$message.info("已经取消删除！");
      }
      const { data: res } = await this.$http.delete("/process/deleteDeploy", {
        params: { deploymentId },
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      });
      console.log(res);
      this.getInfo();

      if (res.flag !== true) {
        return this.$message.error("删除部署信息失败");
      }
      this.$message.success("删除部署信息成功");

      //  this.$http({
      //   method: "delete",
      //   url: "/process/deleteDeploy",
      //   headers: {
      //     "Content-Type": "application/x-www-form-urlencoded",
      //   },
      //   data:this.definition.deploymentId,
      // }).then((res) => {
      //   console.log(res);
      // });
    },
    //下载bpmn文件接口
    downloadBpmn() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=leave";
    },

    //下载png文件接口
    downloadPng() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=leave";
    },
    //下载bpmn文件接口
    downloadBpmn1() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=reimbursement";
    },

    //下载png文件接口
    downloadPng1() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=reimbursement";
    },
    //下载bpmn文件接口
    downloadBpmn2() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=fillClock";
    },

    //下载png文件接口
    downloadPng2() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=fillClock";
    },
    //下载bpmn文件接口
    downloadBpmn3() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=travel";
    },

    //下载png文件接口
    downloadPng3() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=travel";
    },
    //下载bpmn文件接口
    downloadBpmn4() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=adjustJob";
    },

    //下载png文件接口
    downloadPng4() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=adjustJob";
    },
    //下载bpmn文件接口
    downloadBpmn5() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=adjustSalary";
    },

    //下载png文件接口
    downloadPng5() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=adjustSalary";
    },
    //下载bpmn文件接口
    downloadBpmn6() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=overtime";
    },

    //下载png文件接口
    downloadPng6() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=overtime";
    },
    //下载bpmn文件接口
    downloadBpmn7() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=separation";
    },

    //下载png文件接口
    downloadPng7() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=separation";
    },
    //下载bpmn文件接口
    downloadBpmn8() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=positive";
    },

    //下载png文件接口
    downloadPng8() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=positive";
    },
    //下载bpmn文件接口
    downloadBpmn9() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourceBpmnFiles?processKey=destroy";
    },

    //下载png文件接口
    downloadPng9() {
      window.location.href =
        "http://172.27.44.186:8080/process/resourcePngFiles?processKey=destroy";
    },
  },
};
</script>

<style scoped>
.one {
  width: 200px;
  height: 40px;
  background: white;
  border: solid 1px rgb(167, 161, 161);
  display: flex;
  align-items: center;
}
.two {
  float: left;
  width: 12.5%;
}
</style>
